<?php
    include('incs/database.inc.php');
	include('incs/config.inc.php');
	include('incs/function.inc.php');
	db_open();
    $data = $_POST["data"];
    $bulan = $_POST["bulan"];
    $tahun = $_POST["tahun"];
	$jumlah = $_POST["jumlah"];

	for ($row = 0; $row < $jumlah; $row++)
	{
		$loop=0;
        foreach ($data[$row] as $key => $value)
		{
			$aa[$loop]=$value;
			$loop++;
		}
        if(1)
            //echo $aa[0]."-".$aa[1]."-".$aa[2]."-".$aa[3]."-".$aa[4]."-".$aa[5]."-".$aa[6]."-".$aa[7]."-".$aa[8]."-".$aa[9]."-".$aa[10]."-".$aa[11]."-".$aa[12]."-".$aa[13]."-".$aa[14]."<br />";
            $query_update = "UPDATE `l03` SET `GOL_PANJANG_A`=$aa[1], `GOL_PANJANG_AU`=$aa[2], `GOL_PANJANG_C`=$aa[3], `GOL_PANJANG_D`=$aa[4], `GOL_PANJANG_BI`=$aa[5], `GOL_PANJANG_BIU`=$aa[6], `GOL_PANJANG_BII`=$aa[7], `GOL_PANJANG_BIIU`=$aa[8], `JML_PROD`=$aa[9], `JML_RUSAK`=$aa[10], `JML_BIT`=$aa[11] WHERE `ID_SATPAS`='$aa[0]' AND `TAHUN`='$tahun' AND `BULAN`='$bulan'";
            //echo $query_update;
            $query = db_query($query_update);

		   //	echo $aa[0]."-".$aa[1]."-".$aa[2]."-".$aa[3]."-".$aa[4]."-".$aa[5]."-".$total."-".$huruf;
          //  exit();
		}

    $query_s = "SELECT *
				FROM `view_l03` WHERE `bulan`=$bulan AND `tahun`=$tahun";
	$hasil = db_query($query_s);
    while($tampil_data = db_fetch_array($hasil)){
		$arrdata[] = $tampil_data;
	}

    $query_b = "SELECT `DESKRIPSI` FROM `bulan` WHERE `ID`=$bulan LIMIT 1";
	$hasil_b = db_query($query_b);
	$bulannya = db_fetch_array($hasil_b);
?>
<div align="left" style="font-family: verdana;font-size: 12">
    <div align="center">Bulan : <?php echo $bulannya['DESKRIPSI']." ".$tahun;?></div><br />
    <form name="table_cari" action="./lihat_data_3.php">
   <table align="center" border="1" width="1024" cellpadding="5" cellspacing="0" style="font-family: Verdana;font-size: 12">
			<tr align="center">
                <th width="30" height="43" rowspan="3">NO.</th>
                <th width="200" rowspan="3" rowspan="3">POLDA / SATPAS</th>
                <th width="320" colspan="8">GOLONGAN SIM</th>
                <th width="40" colspan="3">JUMLAH</th>
            </tr>
            <tr>
                <th colspan="8">PERPANJANGAN</th>
                <th rowspan="2">PROD SIM</th>
                <th rowspan="2">SIM RUSAK</th>
                <th rowspan="2">BIT SIM</th>
            </tr>
            <tr>
              <th width="40">A</th>
              <th width="40">AU</th>
  			  <th width="40">C</th>
  			  <th width="40">D</th>
  			  <th width="40">BI</th>
              <th width="40">BIU</th>
              <th width="40">BII</th>
  			  <th width="40">BIIU</th>
            </tr>
            <?php $seq_number=1;?>
            <?php foreach($arrdata AS $data) { ?>
            <tr>
                <td><?php echo $seq_number;?></td>
                <td><?php echo $data['NAMA_SATPAS'];?></td>
                <td><?php echo $data['GOL_PANJANG_A'];?></td>
                <td><?php echo $data['GOL_PANJANG_AU'];?></td>
                <td><?php echo $data['GOL_PANJANG_C'];?></td>
                <td><?php echo $data['GOL_PANJANG_D'];?></td>
                <td><?php echo $data['GOL_PANJANG_BI'];?></td>
                <td><?php echo $data['GOL_PANJANG_BIU'];?></td>
                <td><?php echo $data['GOL_PANJANG_BII'];?></td>
                <td><?php echo $data['GOL_PANJANG_BIIU'];?></td>
                <td><?php echo $data['JML_PROD'];?></td>
                <td><?php echo $data['JML_RUSAK'];?></td>
                <td><?php echo $data['JML_BIT'];?></td>
            </tr>
            <?php $seq_number++;?>
            <?php } ?>

     </table>
     <input type="hidden" name="bulan" value="<?php echo $bulan?>">
     <input type="hidden" name="tahun" value="<?php echo $tahun?>">
     <br />
     <div align="center">
        <button title="Klik untuk edit" name="Submit" type="submit" value="Edit">Edit</button>&nbsp;
        <button title="Klik untuk kembali" type="button" onclick="self.location='./index3.php'"  value="Kembali">&laquo; Kembali</button>
        <button title="Klik untuk mencetak" type="button" onclick="self.location='javascript:print()'"  value="Print">Print</button>
     </div>
  </form>
</div>

<br />
